import { Divider } from 'antd';

export const columns = ({ handleEdit }) => [
  {
    title: '活动名称/ID',
    dataIndex: 'searcherKey',
    hideInTable: true,
  },
  {
    title: '活动信息',
    dataIndex: 'activite',
    align: 'left',
    width: 200,
    hideInSearch: true,
    render: (_, record) => (
      <div style={{}}>
        <div style={{ fontSize: '14px' }}>{record.activityName}</div>
        <div style={{ fontSize: '14px', color: '#1677ff' }}>ID:{record.id || '-'}</div>
      </div>
    ),
  },
  {
    title: '活动状态',
    dataIndex: 'activityStatus',
    valueType: 'select',
    valueEnum: {
      1: '未开始',
      2: '进行中',
      3: '已结束',
      4: '已失效',
    },
  },
  {
    title: '参与人数',
    dataIndex: 'activityNumber',
    hideInSearch: true,
  },
  {
    title: '中奖人数',
    dataIndex: 'prizeNumber',
    align: 'left',
    hideInSearch: true,
  },
  {
    title: '活动时间',
    dataIndex: 'consumerName',
    align: 'left',
    valueType: 'dateRange',
    fieldProps: {},
    search: {
      transform: (value) => {
        return {
          startTime: value[0],
          endTime: value[1],
        };
      },
    },
  },
  {
    title: '操作',
    align: 'left',
    hideInSearch: true,
    render: (record) => (
      <div>
        <a onClick={() => handleEdit('edit', record)}>编辑</a>
        <Divider type="vertical" />
        <a onClick={() => handleEdit('edit', record)}>详情</a>
        <Divider type="vertical" />
        <a onClick={() => handleEdit('delete', record)}>失效</a>
        <Divider type="vertical" />
        <a onClick={() => handleEdit('delete', record)}>中奖记录</a>
      </div>
    ),
  },
];
